//
//  WebLinkViewController.m
//  eBook
//
//  Created by zhy on 12-12-21.
//  Copyright (c) 2012年 zhan. All rights reserved.
//

#import "WebLinkViewController.h"

@interface WebLinkViewController ()

@end

@implementation WebLinkViewController
@synthesize URLString;
@synthesize weblinkWebView;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    weblinkWebView.delegate = self;
    
    NSURL *url = [NSURL URLWithString:URLString];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [weblinkWebView loadRequest:request];
}

- (void)viewDidUnload
{
    [self setWeblinkWebView:nil];
    [super viewDidUnload];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft||interfaceOrientation==UIInterfaceOrientationLandscapeRight);
}

//ios 6 rotation
-(NSUInteger)supportedInterfaceOrientations{
//    return UIInterfaceOrientationLandscapeLeft;//xcode 4.4
    return UIInterfaceOrientationMaskLandscape;//xcode 4.5
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (IBAction)backAction:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^{}];
}
@end
